package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.MemberDO;
import com.ssy.lingxi.member.merchant.entity.MemberRoleDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 会员自定义角色操作类
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-28
 */
@Repository
public interface MemberRoleRepository extends JpaRepository<MemberRoleDO, Long>, JpaSpecificationExecutor<MemberRoleDO> {
    MemberRoleDO findFirstByMemberAndId(MemberDO memberDO, Long id);

    boolean existsByMemberAndRoleName(MemberDO memberDO, String roleName);

    boolean existsByMemberAndRoleNameAndIdNot(MemberDO memberDO, String roleName, Long id);

    List<MemberRoleDO> findByMemberAndTypeEnum(MemberDO member, Integer typeEnum);
}
